package com.buba.other.controller;


import com.buba.other.service.AliossService;
import com.buba.other.service.HospitalGuideService;
import com.buba.utils.AliOss;
import com.buba.utils.R;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * <p>
 * 院内导航表 前端控制器
 * </p>
 *
 * @author testjava
 * @since 2022-06-09
 */
@RestController
@Slf4j
@RequestMapping("/other/hospital-guide")
public class HospitalGuideController {


    @Autowired
    private HospitalGuideService hospitalGuideService;

    @Autowired
    private AliossService aliossService;

    /**
     * @Author 梁玉杰
     * @Description //根据院区id查询院内导航列表
     * @Return com.buba.utils.R
     * @throws
     * @Date 2022/6/10 16:00
     **/
    @ApiOperation(value = "根据院区id查询院内导航列表")
    @PostMapping("/findAllBYCampusId/{id}")
    public R findAllCampus(@PathVariable Integer id) {
        return hospitalGuideService.findAllBYCampusId(id);
    }

    @ApiOperation(value = "oss上传图片")
    @PostMapping("/upload")
    public R upload(MultipartFile file) {
        String url = aliossService.upload(file);
        log.info("url:::::!::::"+url);
        return R.ok().data("url",url);
    }


}

